<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>箭头函数使用方法2</title>
  <script type="text/javascript">

    //传统方式
    let f1=function (n,m){
      let res=0
      for(let i=n;i<m;i++){
        res+=i;
      }
      return res;
    }
    console.log("传统方式: "+f1(0,5)) //10

    //es4
    let f1=(n,m)=>{
      let res=0
      for(let i=n;i<m;i++){
        res+=i;
      }
      return res;
    }
    console.log("es6方式: "+f1(0,5)) //10
  </script>
</head>
<body>

</body>
</html>